﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="admin_inc/admin.function.asp" -->
<!--#include file="admin_inc/admin.sqlfunction.asp" -->
<%
'作者：山林客（ah_bill）
'博客：http://ruizhinet.blog.163.com
'网站：http://www.ruizhinet.cn
'本信息不会影响您网站的正常访问，请保留
checkadmin(1)
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>字符列表</title>
<link type="text/css" href="style/style.css" rel="stylesheet" rev="stylesheet"/>
<script type="text/javascript" language="javascript" src="admin_js/common.js"></script>
<script type="text/javascript" language="javascript" src="admin_js/net.js"></script>
</head>
<body>
<br/><div style="width:600px;margin:0px auto;"><br/>“键”必须符合变量名命名规则，为避免与其他系统变量冲突，本系统固定以“lang_”开头<br/>“值”是由“|”分隔的字符串，左侧是英文，右侧是中文。<br/><br/>
<div style="width:600px;margin:0px auto;">
快速定位：<input type="text" name="name" onkeyup="ajax_checkWord('words',this.value);"/>（请输入你要检索的关键字，然后点击相应项，请输入两个以上字符）
<div id="showlayer" style="position:relative;display:none;"><div style="margin-left:0px;border:1px;cursor:pointer;background:#99FF00;width:100px;height:14px;background:url(images/close.gif)" onclick="document.getElementById('showlayer').style.display='none';"></div>
<div id="show" style="position:absolute;left:0px;top:15px;background:#FFFF99;border:1px solid;overflow:auto;width:500px;height:150px;"></div>
</div>
</div>
</div>
<div>
<form name="rzform" action="?act=modifysave" method="post" id="rzform">
<input type="hidden" name="listtype" value="words"/>
<table cellspacing="0" cellpadding="0" class="table_800">
<tr>
<th>选择</th>
<th>键</th>
<th>值（英文|中文）</th>
<th>调用标记</th>
</tr>
<%
dim page,sql,MyPage,rs,keyword
keyword=Trim(request.querystring("keyword"))
page=GetIntQueryString("page")
act=HTMLEncode(request("act"))
If keyword<>"" Then 
keyword=unescape(keyword)
sql="select * from c_words where w_name like '%"&keyword&"%'"
Else 
sql="select * from c_words order by w_name"
End If 
if page<=1 then
page = 1
end if
Set MyPage = New RZPage
MyPage.SetSQL = sql
MyPage.PageSize = 30
MyPage.SetCss_PreNext="nextprev"
MyPage.SetCss_NumPage="pagenum"
MyPage.SetCss_CurrentPage="currentpage"
Set rs = MyPage.GetRS()
dim i
For i=1 To MyPage.PageSize
If Not rs.EOF Then 
%> 
<tr class="row">
<td><input type="checkbox" name="id" id="id" value="<%=rs("id")%>"  onclick="chkRow(this);"/></td>
<td><%=rs("w_name")%></td>
<td><input type="text" id="<%=rs("w_name")%>" name="<%=rs("w_name")%>" value="<%=rs("w_value")%>"  size="70"/></td>
<td>@{<%=rs("w_name")%>}</td>
</tr>
<%
rs.Movenext
Else
Exit For
End If
Next

%>
<tr class="row">
<td>&nbsp;</td>
<td><input type="text" id="w_newname" name="w_newname" value="" /></td>
<td><input type="text" id="w_newvalue" name="w_newvalue" value="" size="70"/></td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="4" class="tdcenter">
<input name="selectall" type="checkbox" id="selectall" value="" onclick="selectAll();" />全选&nbsp;&nbsp;&nbsp;<input type="submit" class="btn"  value="保存"/>&nbsp;&nbsp;&nbsp;<input type="button"  class="btn"  name="del" onclick="deleteselect();" value="删除"/>
</td>
</tr>
</table>
</form>
<div id="bottompage">
<%MyPage.ShowPage()%>
<span class="recordcount">
<%MyPage.ShowPageInfo()%>
</span>
</div>

</body>
</html>

<%
dim act
act=trim(request.QueryString("act"))
If act="modifysave" Then
	Call ModifySave()
End If
Sub ModifySave()
Dim x
For Each x In Request.Form
conn.Execute("update  [c_words] set w_value='"&HTMLEncode(request.Form(x))&"' where w_name='"&x&"'")
Next
Dim newname,newvalue
newname=HTMLEncode(request.Form("w_newname"))
newvalue=HTMLEncode(request.Form("w_newvalue"))
If newname<>"" And newvalue<>"" Then 
	If Left(newname,5)<>"lang_" Then 
		response.write("<script type='text/javascript' language='javascript'>alert('键名必须以lang_开头');</script>")
		response.end
	ElseIf InStr(newvalue,"|")=0 Then 
		response.write("<script type='text/javascript' language='javascript'>alert('值必须以|分隔');</script>")
		response.end
	Else
		Dim rs,sql,test
		test=True
		Set rs = Server.CreateObject("ADODB.Recordset")
		sql = "select * from [c_words] where w_name='"&newname&"'"
		rs.open sql,conn,1,1
		If not rs.eof Then 
			test=False
		End If
		rs.close
		Set rs=Nothing 
		If test=False then
			response.write("<script type='text/javascript' language='javascript'>alert('键名重复，请使用其他键名');</script>")
			response.End
		Else  
			conn.Execute("insert into [c_words](w_name,w_value) values('"&newname&"','"&newvalue&"')")
		End If 
	End If
End If 
Call SetSiteWords()
response.redirect("words_list.asp")
End Sub
%>